﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace JiveMessenger.Models
{
    public class DisplayMessage : INotifyPropertyChanged
    {


        private DisplayMessageOptions _messageOption;
        public DisplayMessageOptions MessageOptions
        {
            get { return _messageOption; }
            set
            {
                if (_messageOption != value)
                {
                    _messageOption = value;
                    RaisePropertyChanged("MessageOptions");
                }
            }
        }


        private IContact _sender;
        public IContact Sender
        {
            get { return _sender; }
            set
            {
                if (_sender != value)
                {
                    _sender = value;
                    RaisePropertyChanged("Sender");
                }
            }
        }

        private string _chatTarget;
        public string ChatTarget
        {
            get { return _chatTarget; }
            set
            {
                if (_chatTarget != value)
                {
                    _chatTarget = value;
                    RaisePropertyChanged("ChatTarget");
                }
            }
        }

        private DateTime _timeStamp;
        public DateTime TimeStamp
        {
            get { return _timeStamp; }
            set
            {
                if (_timeStamp != value)
                {
                    _timeStamp = value;
                    RaisePropertyChanged("TimeStamp");
                }
            }
        }


        private string _message;
        public string Message
        {
            get { return _message; }
            set
            {
                if (_message != value)
                {
                    _message = value;
                    RaisePropertyChanged("Message");
                }
            }
        }


        private bool _isLastInBatch;
        public bool IsLastInBatch
        {
            get { return _isLastInBatch; }
            set
            {
                if (_isLastInBatch != value)
                {
                    _isLastInBatch = value;
                    RaisePropertyChanged("IsLastInBatch");
                }
            }
        }

        public DisplayMessage(IContact sender, string message, DisplayMessageOptions options, DateTime timestamp, bool isLastInBatch)
        {
            this.Sender = sender;
            this.Message = message;
           // this.ChatTarget = chatTarget;
            this.MessageOptions = options;
            this.TimeStamp = timestamp;
            this.IsLastInBatch = isLastInBatch;
        }

        public DisplayMessage(IContact sender, string message, string chatTarget, DisplayMessageOptions options, DateTime timestamp, bool isLastInBatch)
        {
            this.Sender = sender;
            this.Message = message;
            this.ChatTarget = chatTarget;
            this.MessageOptions = options;
            this.TimeStamp = timestamp;
            this.IsLastInBatch = isLastInBatch;
        }
        protected void RaisePropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
        }
        public event PropertyChangedEventHandler PropertyChanged;
    }
}
